const http = require('http')

const server = http.createServer(((req, res) => {
  // 获取请求方法
  console.log(req.method)
  // 获取请求url
  console.log(req.url)
  // 获取http版本协议号
  console.log(req.httpVersion)
  // 获取http请求头
  console.log(req.headers)
  res.end('hello')
}))

server.listen(3000, () => {
  console.log('启动成功！')
})